#ifndef __MAPUTILS__
#define __MAPUTILS__

#include <e32base.h>
#include <lbsposition.h>

extern const TReal64 kTilesResolutions[];

extern const TReal64 kTilesResolutionsSVY21[];

extern const TReal64 kSVY21BoundsLat;
extern const TReal64 kSVY21BoundsLong;

extern const TReal64 kTileOrigE;
extern const TReal64 kTileOrigN;

extern const TReal64 kAlphaE, kBetaE;
extern const TReal64 kAlphaN, kBetaN;

TInt ZoomLevels();

// =====================================
// http://dominoc925.blogspot.com/p/svy21-coordinate-converter.html
extern TReal ELLIPSOID_SEMIMAJORAXIS;
extern TReal ELLIPSOID_ECCENTRICITY;
extern TReal ELLIPSOID_FLATTENING;
extern TReal PROJ_NATURALORIGINLATITUDE;
extern TReal PROJ_NATURALORIGINLONGITUDE;
extern TReal PROJ_SCALEFACTOR;
extern TReal PROJ_FALSEEASTINGS;
extern TReal PROJ_FALSENORTHINGS;

struct TENCoordinate
{
	TReal iEasting;
	TReal iNorthing;
	TENCoordinate(TReal aEasting, TReal aNorthing);
};

struct MathUtils
	{
	static TReal Tan(TReal aX);
	static TReal Cos(TReal aX);
	static TReal Sin(TReal aX);
	static TReal Sqrt(TReal aX);
	static TReal Ln(TReal aX);
	static TReal ATan(TReal aX);
	static TReal Exp(TReal aX);
	static TInt Int(TReal aX);
	static TInt Floor(TReal aX);
	static TReal Pow(TReal aX, TReal aPower);
	static const TReal PI;
	};

TReal SecondEccentricity();
TReal CnvDegToRad(TReal deg);
TReal calc_A(TReal latRad,TReal lngRad);
TReal calc_T(TReal latRad);
TReal calc_C(TReal latRad);
TReal calc_v(TReal latRad);
TReal calc_M(TReal latRad);
TENCoordinate CnvLL2EN(TReal latDeg, TReal lngDeg);
TInt Long2TileX(TReal64 lon, TInt z);
TInt Lat2TileY(TReal64 lat, TInt z);
TReal64 TileY2Lat(TInt y, TInt z);
TReal YScale(const TCoordinate& aCoord);

#endif// __MAPUTILS__
